package com.siemens.industrial.model.partner;

import org.springframework.jdbc.core.RowMapper;

import java.util.Date;

/**
 * Created by qupen on 2016/11/8.
 */
public class ProductInfo {

    private String deviceId;
    private Date startTime;
    private Date endTime;
    private String userId;
    private int productNum;
    private int goodNum;
    private int badNum;
    private double rate;
    private int workDiffTime;
    private int stopDiffTime;
    private Date createTime;
    private Date updateTime;

    private static final RowMapper<ProductInfo> rowMapper = (resultSet, i) -> {
        ProductInfo productInfo= new ProductInfo();
        productInfo.setDeviceId(resultSet.getString("device_id"));
        productInfo.setStartTime(resultSet.getTimestamp("start_time"));
        productInfo.setEndTime(resultSet.getTimestamp("end_time"));
        productInfo.setUserId(resultSet.getString("user_id"));
        productInfo.setProductNum(resultSet.getInt("product_num"));
        productInfo.setGoodNum(resultSet.getInt("good_prod_num"));
        productInfo.setBadNum(resultSet.getInt("bad_prod_num"));
        productInfo.setRate(resultSet.getDouble("prod_rate"));
        productInfo.setWorkDiffTime(resultSet.getInt("work_diff_time"));
        productInfo.setStopDiffTime(resultSet.getInt("stop_diff_time"));
        productInfo.setCreateTime(resultSet.getTimestamp("create_time"));
        productInfo.setUpdateTime(resultSet.getTimestamp("update_time"));
        return productInfo;
    };


    public static RowMapper<ProductInfo> getRowMapper() {
        return rowMapper;
    }

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public int getProductNum() {
        return productNum;
    }

    public void setProductNum(int productNum) {
        this.productNum = productNum;
    }

    public int getGoodNum() {
        return goodNum;
    }

    public void setGoodNum(int goodNum) {
        this.goodNum = goodNum;
    }

    public int getBadNum() {
        return badNum;
    }

    public void setBadNum(int badNum) {
        this.badNum = badNum;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public double getRate() {
        return rate;
    }

    public void setRate(double rate) {
        this.rate = rate;
    }

    public int getWorkDiffTime() {
        return workDiffTime;
    }

    public void setWorkDiffTime(int workDiffTime) {
        this.workDiffTime = workDiffTime;
    }

    public int getStopDiffTime() {
        return stopDiffTime;
    }

    public void setStopDiffTime(int stopDiffTime) {
        this.stopDiffTime = stopDiffTime;
    }
}
